home *** CD-ROM | disk | FTP | other *** search
- Path: hursley.ibm.com!news
- From: Max Waterman <dwater@wight.hursley.ibm.com>
- Newsgroups: comp.lang.c
- Subject: Re: HELP : Assignment with strings and pointers.
- Date: Fri, 12 Apr 1996 10:00:13 +0100
- Organization: IBM UK Laboratories Ltd.
- Message-ID: <316E1B9D.15FB@wight.hursley.ibm.com>
- References: <316ac5b5.4283622@news.planet.net> <4keairINN3jv@mayne.ugrad.cs.ubc.ca> <316B9FFA.ABD@wight.hursley.ibm.com> <316bb0ec.1309731@newshost>
- NNTP-Posting-Host: wight.hursley.ibm.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (X11; I; AIX 2)
-
- OK. But the gist is there? I was hoping that my example showed an
- alternative coding style - that was why I did it - not for the accuracy.
- But you're quite right, of course, I should have made that more clear.
-
- Can you fix it - in the same style I wrote it?
-
- Max.
-
- Ken Nicolson wrote:
- >
- > Max Waterman <dwater@wight.hursley.ibm.com> wrote:
- >
- > >Not alot of difference, though. But I'll bet I get flamed for this - I haven't checked it
- > You *will* get flamed if you post wrong code offered as a solution, but at
- > least you admit not to checking it. It is obvious that given the lines:
- >
- > > Size_T length_of_s2 = strlen( s2 );
- > ...
- > > Int s2_index = length_of_s2 - s1_index;
- > > strings_are_same_backwards = ( s1[s1_index] == s2[s2_index] );
- > when s1_index == 0 first time in, the expression "s2[s2_index]" is
- > effectively s2[strlen( s2 )], the terminating '\0', not the last character
- > in the string, so this routine will only work when s1 and s2 are empty
- > strings.
- >
- > >- and people usually get flamed in this group, no matter what they say. It's quite
- > No, people usually get flamed when they post incorrect information. A wrong
- > answer is worse than no answer at all.
- >
- > Ken
-
- --
- ___ mailto:max-lton@tcp.co.uk
- / / / _ / / _ __ __ _ __ _
- / / / /_/ |/ / / / /_/ / /_ /_/ / / / /_/ /| /
- / / / / / /| /_/_/ / / / /_ / | / / / / / / |/
-